package com.jp.knowledge.view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.GridView;

import com.jp.knowledge.adapter.CusAdaper;
import com.jp.knowledge.model.ExpData;

import java.util.List;

/**
 * Created by jiayen on 16/11/3.
 * <p>
 * 针对体验的ui定制的view
 */

public class WrapTiYanView extends GridView {

    //    private i dnames;
    private Context mContext;

    private CusAdaper adapter;
    private List<ExpData.NewDataBean> list;

    public WrapTiYanView(Context context) {
        this(context, null);
    }

    public WrapTiYanView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public WrapTiYanView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.mContext = context;
        initData();
    }

    @Override
    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
                MeasureSpec.AT_MOST);
        super.onMeasure(widthMeasureSpec, expandSpec+50);
    }

    /**
     * 初始化数据
     */
    private void initData() {

    }

    public void setData(List<ExpData.NewDataBean> list) {
        adapter = new CusAdaper(list,mContext);
        this.list = list;
        this.setAdapter(adapter);
    }

}
